package top.aylan.org.ctrl.home;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import top.aylan.org.entity.Banner;
import top.aylan.org.entity.BannerExample;
import top.aylan.org.service.BannerService;
import top.aylan.org.tools.Pager;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/11/18.
 */
@Controller
public class IndexController {

    @Resource
    BannerService bannerService;

    @RequestMapping(value = {"","/","/index","index.html"})
    public String index(ModelMap model){
        model.addAttribute("controllerName","index");
        model.addAttribute("actionName","index");
        try {
            List<Banner> banner = bannerService.selectBannerInUse();
            model.addAttribute("banner",banner);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return "home/index";
    }

    @RequestMapping(value = "/about")
    public String about(ModelMap model){
        model.addAttribute("controllerName","index");
        model.addAttribute("actionName","about");
        return "/home/about";
    }


    @RequestMapping(value = "/contact")
    public String contact(ModelMap model){
        model.addAttribute("controllerName","index");
        model.addAttribute("actionName","contact");
        return "/home/contact";
    }

    @RequestMapping(value = "/fetura")
    public String fetura(ModelMap model){
        model.addAttribute("controllerName","index");
        model.addAttribute("actionName","fetura");
        return "/home/fetura";
    }


}
